package comxyp.controller;
import comxyp.common.Constant;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpSession;

//该控制器作用 就是负责所有要转发的页面
@Controller
@RequestMapping("/global")
public class GlobalController {
    /*跳转到登录页面*/
   @RequestMapping("/login")
    public String toIndex(){
       return "settings/qx/user/login";
   }
   //跳到首页
   @RequestMapping("/index")
   public String index(){
       return "workbench/index";
   }
    //退出系统
    @RequestMapping("/logout")
    public String logout(HttpSession session){
        //清空session
        session.removeAttribute(Constant.user);
        return "settings/qx/user/login";
    }
    //跳到工作台
    @RequestMapping("/mainIndex")
    public String mainIndex(){
        return "workbench/main/index";
    }
    //跳到详情页
    @RequestMapping("/detail")
    public String detail(){
        return "workbench/activity/detail";
    }
    static int count=0;
    @RequestMapping("/count")
    public String count(HttpSession session){
        if(count==0){
            count++;
            session.setAttribute("count",count);
        } else {
            count+=1;
            session.setAttribute("count",count);
        }
        return "settings/qx/user/count";
    }
    //去到市场活动页面
    @RequestMapping("/activity")
    public String activity(){
        return "workbench/activity/index";
    }
}
